<?php defined('_JEXEC') or die('Restricted access'); ?>
<form action="index.php" method="post" name="adminForm">
<div id="editcell">
	<table class="adminlist">
	<thead>
		<tr>
			<th width="5">
				<?php echo JText::_( 'ID' ); ?>
			</th>
			<th width="20">
				<input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $this->items ); ?>);" />
			</th>			
			<th width="50%">
				<?php echo JText::_( 'House Name' ); ?>
			</th>
			<th width="80">
				<?php echo JText::_( 'Ordering' ); ?>
			<?php echo JHTML::_('grid.order', $this->items); ?>
			</th>
			<th>
				<?php echo JText::_( 'Members' ); ?>
			</th>
		</tr>
	</thead>
	<?php
	$k = 0;
	
	for ($i=0, $n=count( $this->items ); $i < $n; $i++)	{
		$row = &$this->items[$i];
		$checked 	= JHTML::_('grid.id',   $i, $row->c_id );
		$link 		= JRoute::_( 'index.php?option=com_congregation&controller=house&task=edit&cid[]='. $row->c_id );
		?>
		<tr class="<?php echo "row$k"; ?>">
			<td>
				<?php echo $row->p_id; ?>
			</td>
			<td>
				<?php echo $checked; ?>
			</td>
			<td>
				<a href="<?php echo $link ?>" onclick="return listItemTask('cb<?php echo $i; ?>', 'edit')">
				<?php echo $row->c_name ; ?>
				</a>
			</td>
			<td>
          <div style="float:left; width:20px;"><?php echo $this->pagination->orderUpIcon($i, true, 'orderup', 'Move Up', true); ?></div>
          <div style="float:left; width:20px;"><?php echo $this->pagination->orderDownIcon($i, $n, true, 'orderdown', 'Move Down', true); ?></div>
          <input type="text" name="order[]" size="5" value="<?php echo $row->ordering; ?>" class="text_area" style="text-align: center" />
			</td>
			<td>
				<?php echo $row->members ; ?> <a href="<?php echo JRoute::_( 'index.php?option=com_congregation&controller=profile&c_id=' . $row->c_id ) ?>"><?php echo JText::_( 'View' ) ?></a>
				 | 
				 <a href="<?php echo JRoute::_( 'index.php?option=com_congregation&controller=profile&task=add&c_id=' . $row->c_id ) ?>"><?php echo JText::_( 'Add new' ) ?></a>
				 
			</td>
		</tr>
		<?php
		$k = 1 - $k;
	}
	?>
	</table>
</div>

<input type="hidden" name="option" value="com_congregation" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="controller" value="house" />
<input type='hidden' name='p_id' value="<?php echo $this->_p_id ?>" />
</form>
